<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<p id="demo">单击按钮升序排列数组。</p>
		<button onclick="myFunction()">点我</button>
	<script>
			function myFunction(){
			var fruits=[40,100,1,5,25,10];
			fruits.sort(function (x,y) {
            return x-y;
       });
       document.writeln(fruits);
     }
	</script>
	</body>
</html>
